<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
	<title>{$site_seo_title}</title>
	<base id="headbase" href="__TMPL__/seatsel/" />
<!--
EOT;
require_once PrintEot('css_mui');
print <<<EOT
-->
<style>
.sim-panel{font-size: 14px;line-height: 24px;}
.pay-btn{background: #FF4200;border: 1px solid #FF4200;padding: 8px 0;font-size: 14px;}
</style>
</head>
<body>
<header class="mui-bar mui-bar-nav">
	<a href="{$returnUrl}" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	<h1 class="mui-title">充值中心</h1>
</header>

<div class="mui-content"></div>

<div class="sim-panel">
	<div class="sim-body">
		<div class="">商品名称：{$orderInfo['title']}</div>
		<div class="">下单时间：{$orderInfo['create_time_show']}</div>
	</div>
</div>

<div class="sim-panel">
	<div class="sim-body">
		商品总额<div class="orange fr">{$orderInfo['total_fee']}元</div>
	</div>
</div>

<div class="mui-content-padded">
	<button type="button" class="mui-btn mui-btn-danger mui-btn-block pay-btn J_doPay">立即支付</button>
</div>

<!--
EOT;
$layerStyle = 2;
require_once PrintEot('script');
print <<<EOT
-->
<script type="text/javascript">
var url_index = "{$returnUrl}";
var url_updateQfOrder = "{@url:mobilecard/qfpay/updateQfOrder}";

var orderId = {$orderId};
var title = "{$orderInfo['title']}";
var cash_cost = {$orderInfo['total_fee']}; //商品现金价格
var gold_cost = 0; //商品金币价格

var type = 10002; //千帆订单类型
var item = new Array();
item[0] = {
	'title': title,
	"cover":"",
	"num":1,
	'gold_cost': gold_cost,
	'cash_cost': cash_cost,
};
var item_json = JSON.stringify(item);
var send_type = 0;
var address =  JSON.stringify({name:"",mobile:"",address:""});
$('.J_doPay').on("click", function(){
	QFH5.createOrder(type,item_json,send_type,address,4,function(state,data){
//		   alert(JSON.stringify(data));
		if(state == 1){
			var qfOrderId = data.order_id;
			//alert(orderId);

			var param = {
				'order_id': orderId,
				'qf_order_id': qfOrderId
			};
			$.post(url_updateQfOrder, param, function(ret){
				if(ret.status=='success'){
					//根据订单id，调起支付页面
					QFH5.jumpPayOrder(qfOrderId,function(state,data){
						 if(state==1){
							 //支付成功
							Wei.Util.wapTipNew({msg: '支付成功', icon: 1}, function(){
								  setTimeout(function(){
									   window.location.href = url_index;
								  }, 500);
							});
						 }else{
							 //支付失败、用户取消支付
							 alert(data.error);//data.error	 string
						 }
					});
				}else if(ret.status=='error'){
					Wei.Util.resultTip({
						msg : ret.msg,
						error : true
					});
				}
			},'json');
		}else if(state == 2){
			var error = data.error;
			 Wei.Util.wapTip({
				 msg : error,
				 error : true,
			 });
		}
	});
});
</script>